<template>
  <div id="user">
    <header>
      <div class="header-tit">
        <div class="top">
          <img @click="$router.push('/info')" :src="infoList!=={}?infoList.avatar:''" alt="" />
          <span v-if="infoList=={}" @click="$router.push('/login')" class="del">登录/注册</span>
          <span v-if="infoList!=={}" class="del">{{ infoList.nickname }}</span>

          <span class="bj"><van-icon name="edit" />编辑</span>
        </div>
        <div class="bottom">
          <div class="a1">
            <p style="color: #f95329">0</p>
            <p style="color: #000">我的课程</p>
            <p style="color: #999">-已购课程学习-</p>
          </div>
          <div class="a1">
            <p style="color: #f95329">0</p>
            <p style="color: #000">我的预约</p>
            <p style="color: #999">-一对一老师预约-</p>
          </div>
          <div class="a1">
            <p style="color: #f95329">0</p>
            <p style="color: #000">剩余学习币</p>
            <p style="color: #999">-查看剩余学习币-</p>
          </div>
        </div>
      </div>
    </header>

    <div class="cen">
      <div class="cen-1">
        <van-icon name="envelop-o" />
      </div>
      <div class="cen-2">
        <p>邀请好友注册APP，享多重好礼</p>
        <p>限时特惠，多邀多得</p>
      </div>
      <div class="cen-3">&gt;</div>
    </div>

    <div class="tab-1">
      <h4>课程相关</h4>
      <div class="box">
        <div class="tab-1-m">
          <img src="../../assets/img/keben.png" alt="" />
          <p>我的作业</p>
        </div>
        <div class="tab-1-m" @click="$router.push('/concern')">
          <img src="../../assets/img/wode.png" alt="" />
          <p>关注的老师</p>
        </div>
        <div class="tab-1-m">
          <img src="../../assets/img/xingxing.png" alt="" />
          <p>我的收藏</p>
        </div>
        <div class="tab-1-m">
          <img src="../../assets/img/xiazai.png" alt="" />
          <p>我的下载</p>
        </div>
      </div>
    </div>

    <div class="tab-1">
      <h4>订单相关</h4>
      <div class="box">
        <div class="tab-1-m">
          <img src="../../assets/img/wodedingdan.png" alt="" />
          <p>我的订单</p>
        </div>
        <div class="tab-1-m">
          <img src="../../assets/img/shouhuodizhi.png" alt="" />
          <p>收获地址</p>
        </div>
      </div>
    </div>

    <div class="tab-1">
      <h4>订单账户</h4>
      <div class="box">
        <div class="tab-1-m">
          <img src="../../assets/img/youhuiquan.png" alt="" />
          <p>优惠券</p>
        </div>
        <div class="tab-1-m">
          <img src="../../assets/img/yinhangka.png" alt="" />
          <p>学习卡</p>
        </div>
        <div class="tab-1-m">
          <img src="../../assets/img/huiyuan.png" alt="" />
          <p>会员</p>
        </div>
      </div>
    </div>

    <div class="tab-1">
      <h4>自助服务</h4>
      <div class="box">
        <div class="tab-1-m">
          <img src="../../assets/img/lingdang.png" alt="" />
          <p>我的消息</p>
        </div>
        <div class="tab-1-m">
          <img src="../../assets/img/xinfeng.png" alt="" />
          <p>意见反馈</p>
        </div>
        <div class="tab-1-m">
          <img src="../../assets/img/kefu.png" alt="" />
          <p>在线客服</p>
        </div>
        <div class="tab-1-m" @click="$router.push('/option')">
          <img src="../../assets/img/shezhi.png" alt="" />
          <p>设置</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getUserInfo } from "@/utils/api.js";
export default {
  data() {
    return {
      
      flag: true,
      infoList: {
        avatar: require("../../assets/img/header-logo.png"),
      },
    };
  },
  created() {
    if (localStorage.getItem("remember_token")) {
      this.name = localStorage.getItem("name");
    }
    this.getInfo();
    // if(this.infoList=={}){

    // }
  },
  methods: {
    async getInfo() {
      let res = await getUserInfo();
      console.log(res);
      this.infoList = res.data.data;
    },
  },
};
</script>

<style lang="scss" scoped>
header {
  position: relative;
  width: 100vw;
  height: 200px;
  border-bottom-left-radius: 120px;
  border-bottom-right-radius: 120px;
  background: #fb5500;
  .header-tit {
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    height: 300px;
    border-radius: 15px;
    background: white;
    .top {
      position: relative;
      height: 50%;
      img {
        position: absolute;
        top: 50%;
        left: 20px;
        transform: translateY(-50%);
        width: 100px;
        height: 100px;
      }
      .del {
        position: absolute;
        top: 50%;
        left: 150px;
        transform: translateY(-50%);
      }
      .bj {
        position: absolute;
        top: 50px;
        right: 0;
        display: inline-block;
        width: 120px;
        height: 50px;
        color: white;
        font-size: 25px;
        line-height: 50px;
        text-align: center;
        background: #fd5900;
        border-top-left-radius: 30px;
        border-bottom-left-radius: 30px;
      }
    }
    .bottom {
      display: flex;
      height: 50%;
      .a1 {
        width: 33vw;
        font-size: 25px;
        text-align: center;
      }
    }
  }
}
.cen {
  width: 90%;
  height: 100px;
  color: white;
  background: #fe5f01;
  margin-top: 220px;
  margin-left: 5%;
  border-radius: 50px;
  display: flex;
  font-size: 25px;
  justify-content: space-around;
  .cen-1,
  .cen-3 {
    line-height: 100px;
  }
  .cen-2 {
    p {
      margin: 10px 0;
    }
  }
}
.tab-1 {
  width: 90%;
  margin-top: 20px;
  margin-left: 5%;
  background: #eee;
  height: 200px;
  padding: 5px;
  .box {
    width: 100%;
    display: flex;
    .tab-1-m {
      width: 25%;
      height: 100%;
      position: relative;
      img {
        position: absolute;
        top: 30px;
        left: 50%;
        transform: translateX(-50%);
        width: 50px;
        height: 50px;
      }
      p {
        width: 100%;
        position: absolute;
        top: 100px;
        text-align: center;
        font-size: 25px;
      }
    }
  }
}
footer {
  height: 150px;
}
</style>
